<!-- 
  回顾作业

  视频到这了，就在写一次

  04-作业-[v-fro和v-bind的结合]
 -->

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active {
      color: red;
    }
  </style>
</head>

<body>
  <div id="app">
    <!-- ul>li 是快捷键 -->
    <ul v-for='(m, index) in movies'>
      <li 
        :class='{active: currentIndex===index}'
        @click='currentIndex=index'
      >{{m}}</li>
    </ul>
  </div>

  <script src="../../js/vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        movies: ['海王','海贼王','加勒比海盗','海尔兄弟'],
        currentIndex: 0
      },
    })
  </script>

</body>

</html>